home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group93c.txt
/
000051_icon-group-sender _Mon Sep 13 10:00:24 1993.msg
< prev
next >
Wrap
Internet Message Format
|
1994-02-02
|
2KB
Received: from owl.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 13 Sep 1993 09:47:15 MST
Received: by owl.cs.arizona.edu; Mon, 13 Sep 1993 09:47:14 MST
Date: Mon, 13 Sep 1993 10:00:24 -0600 (CST)
From: Chris Tenaglia - 257-8765 <TENAGLIA@MIS.MCW.EDU>
Subject: Re: newbie question
To: icon-group@cs.arizona.edu
Message-Id: <01H2W8U4NC428WWTKA@mis.mcw.edu>
Organization: Medical College of Wisconsin (Milwaukee, WI)
X-Vms-To: IN%"icon-group@cs.arizona.edu"
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-Transfer-Encoding: 7BIT
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
> From: IN%"news-feed-1.peachnet.edu!news-feed-2.peachnet.edu!umn.edu!lynx.unm.edu!dns1.NMSU.Edu!cymorg@gatech.edu" 13-SEP-1993 09:42:19.58
> To: IN%"icon-group@cs.arizona.edu"
> Subj: another newbie question (simple)
> I have another easy to solve (i hope) problem, that i can't
> figure out simply because I dont have any documentation nor
> the money to get the book I so dearly need. I would like
> to somehow take a string s, and rewrite it, say (for example)
> as a new string with each letter being the letter following
> the one in the original word....ie:
> hello, becomes: ifmmp
> how would I do this in icon?
> Thanx,
> Chris
> --
> **--** Woman don't you know with you i'm born again **--**
> > <
> > Chris Fagyal <
> > Cymorg@acca.nmsu.edu <
This can be easily done using the map() expression:
#
# this rotates the characterset in a string.
# input : is the input string
# shift : is the amount of rotation (0 < shift 256)
# use : newstring := rotn(oldstring,13) # to do ROT13 for example
#
procedure rotn(input,shift)
static transpose
initial transpose := string(&cset) || string(&cset)
translate := transpose[shift+:256]
return map(input,&cset,translate)
end
map() takes an input string and two mapping strings that must be of equal
length. Without the mapping strings specified, it defaults to a convert
all strings to lower case. The static and initial make transpose permanent
storage and evaluates it only once (the first time).
Chris Tenaglia (System Manager) | "The past explained,
Medical College of Wisconsin | the future fortold,
8701 W. Watertown Plank Rd. | the present largely appologized for."
Milwaukee, WI 53226 | Organon to The Doctor
(414)257-8765 |
tenaglia@mis.mcw.edu